<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<script type="text/javascript">
<link rel="stylesheet" type="text/css" href="${initParam.root}css/spearmint-tints.css"/>
	$(document).ready(function(){
		$("#loginForm").submit(function(){
			if($("form [name=loginId]").val()==""){
				alert("아이디를 입력해주세요");
				return false;
			}else if($("form [name=loginPassword]").val()==""){
				alert("비밀번호를 입력해주세요");
				return false;
			}
		});
	});
</script>

<center>
	<h3>로그인을 하셔야 이용가능한 서비스 입니다.</h3>
</center> <hr>
<c:choose>
	<c:when test="${sessionScope.userInfo==null}">
	<form action="${initParam.root }member.do" id="loginForm" method="post">
		아이디: <input type="text" name="loginId"><br>
		비밀번호: <input type="password" name="loginPassword"><br>
		<input type="hidden" name="command" value="login">
		<input type="submit" value="로그인">
		</form>
		<a href="${initParam.root }member.do?command=goToRegister">회원가입</a>
	</c:when>
	<c:otherwise>
	<center>
		<c:choose>
			<c:when test="${sessionScope.userInfo.saveFileName==null }">
				<img src="${initParam.root }upload/defaultImg.jpg" width="150" height="170"><br><br>
			</c:when>
			<c:otherwise>
			<img src="${initParam.root }upload/${sessionScope.userInfo.saveFileName }" width="150" height="170"><br><br>
			</c:otherwise>
		</c:choose>
		</center>
		${sessionScope.userInfo.id }님<br>
		<a href="${initParam.root }member.do?command=goToMypage">마이페이지</a><br>
		<a href="${initParam.root }member.do?command=goToUpdate">회원정보수정</a><br>
		보유포인트: ${sessionScope.userInfo.point }
		
		<form action="${initParam.root }member.do" id="logoutForm">
			<input type="hidden" name="command" value="logout">
			<input type="submit" value="로그아웃">
		</form>
		 
	</c:otherwise>
</c:choose>
    